<template>
    <div class="hotGoods_body_box">
        <div class="hotGoods_body_item" v-for="(item,index) in hotGoods" :key="index" @click="goGoodsPage(item.goodsId)">
            <img :src="item.image" alt="">
            <div>
                <p>{{item.name}}</p>
                <p>￥{{item.price | priceFn}}</p>
            </div>
        </div>
    </div>
    
</template>

<script>
import {money} from '@/filter/money.js'
export default {
    props:['hotGoods'],
    filters:{
        priceFn(value){
            return money(value)
        }
    },
    methods:{
        goGoodsPage(goodsId){
            console.log(goodsId)
            this.$router.push({path:'/Goods',query:{goodsId:goodsId}})
        }
    },
    created(){
        console.log(this.hotGoods)
    }
}
</script>

<style scoped>
.hotGoods_body_box{
    display: flex;
    flex-wrap:wrap;
}
.hotGoods_body_box .hotGoods_body_item{
    box-sizing: border-box;
    width:10rem;
}
</style>